package com.bw.sofa_module.detail;

import com.bw.common.mvvm.model.BaseModel;
import com.bw.network_sdk.RetrofitManager;
import com.bw.network_sdk.entity.BaseEntity;
import com.bw.sofa_module.detail.entity.RecommentEntity;
import com.bw.sofa_module.detail.entity.delete.DeleteEntity;
import com.bw.sofa_module.detail.entity.select.RecommentSelectEntity;

import java.util.Map;

import io.reactivex.Observable;
import retrofit2.http.Query;

public class VideoDetailModel extends BaseModel {
    public Observable<BaseEntity> requestAllCommend(long itemId , int pageCount ,int userId){
        Observable<RecommentSelectEntity> recommentSelectEntityObservable = RetrofitManager.getInstance()
                .getRetrofit()
                .create(ApiService.class)
                .requestAllComment(itemId, pageCount, userId);
        return checkNetWork(recommentSelectEntityObservable);
    }

    public Observable<BaseEntity> requestAddComment(String commentText,
                                                    int height,
                                                    String image_url,
                                                    long itemId,
                                                    int userId,
                                                    String video_url,
                                                    int width){
        Observable<RecommentEntity> recommentEntityObservable = RetrofitManager.getInstance()
                .getRetrofit()
                .create(ApiService.class)
                .requestRecomment(commentText, height, image_url, itemId, userId, video_url, width);
        return checkNetWork(recommentEntityObservable);
    }


    public Observable<BaseEntity> requestDelete(long commentId,long itemId,long userId){
        Observable<DeleteEntity> deleteEntityObservable = RetrofitManager.getInstance()
                .getRetrofit()
                .create(ApiService.class)
                .requestDeleteCommit(commentId, itemId, userId);
        return checkNetWork(deleteEntityObservable);
    }

}
